/**
 * Created by Mark on 2018/4/17.
 * 订单模块业务请求
 */


var _mm = require("util/mm.js");

var _order= {
    //1.获取购物中已选中的商品
    getProductList : function(resolve, reject){
        _mm.request({
            url     : _mm.getServerUrl('/order/get_order_cart_product.do'),
            success : resolve,
            method : "get",
            error   : reject
        });
    },
    //2.生成订单
    createOrder : function (orderInfo,resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/order/create.do'),
            data : orderInfo,
            success : resolve,
            error   : reject
        });
    },
    //3.获取订单列表
    getOrderList : function(listParam,resolve, reject){
        _mm.request({
            url     : _mm.getServerUrl('/order/list.do'),
            success : resolve,
            data : listParam,
            error   : reject
        });
    },
    //4.获取订单详情
    getOrderDetail : function (orderNumber,resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/order/detail.do'),
            data : {
                orderNo : orderNumber
            },
            success : resolve,
            error   : reject
        });
    },
    //5.取消订单
    cancelOrder : function (orderNumber,resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/order/cancel.do'),
            data : {
                orderNo : orderNumber
            },
            success : resolve,
            error   : reject
        });
    },
    //5.用户确认收货
    getGoods : function (orderNumber,resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/order/getGoods.do'),
            data : {
                orderNo : orderNumber
            },
            success : resolve,
            error   : reject
        });
    },
}

module.exports = _order;